<!DOCTYPE html>
<html lang="en">
<head>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <title>优惠券详情</title>
    <script src="js/alert.js"></script>
</head>
<body>

<div style="text-align: center;margin-top: 20%">
    <div>
        <div id="code"></div>
    </div>
    <div id="code-val" style="font-size: 35px;"> </div>
</div>

<div style="margin: 5%;">
    <div><span>起始日期: </span><span id="sdate" style="padding-left: 10%">  </span></div>
    <div><span>截止日期: </span><span id="edate" style="padding-left: 10%">  </span></div>
    <div style="margin-top: 5%">使用说明: </div>
    <div id="expl"> </div>
</div>

</body>
<script src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.qrcode.min.js"></script>
<script>
    $(document).ready(function () {
        var code = $.getUrlParam1("code");
        var account = $.getUrlParam1("account");

        $('#code').qrcode({width: 200, height: 200, text: code});
        $('#code-val').html(code);

        $.ajax({
            "url": "/messageTemplate/item/",
            "data":"code="+code+"&account="+account,
            "type": "POST",
            "dataType": "json",
            "success": function (json) {
                $("#sdate").html(json.data.datebeg);
                $("#edate").html(json.data.dateend);
                $("#expl").html(json.data.expl);
            }})

    });

</script>
<script>
    (function ($) {
        $.getUrlParam1 = function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null)
                return decodeURI(r[2]);
            return null;
        }
    })(jQuery);
</script>
</html>